<?php
require_once '../include/init.php';
require_once '../core/pro.php';
require_once '../core/thumb.php';
require_once '../core/cate.php';
$cates=getallgoodcate();
$id=$_GET['id'];
$sql='select * from pro where id='.$id;
$new=getRow($sql);




?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>-.-</title>
<link href="./styles/global.css"  rel="stylesheet"  type="text/css" media="all" />
<script type="text/javascript" charset="utf-8" src="../kindeditor/kindeditor.js"></script>
<script type="text/javascript" charset="utf-8" src="../kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript" src="../kindeditor/jquery-1.6.4.js"></script>
<script>
        KindEditor.ready(function(K) {
                window.editor = K.create('#editor_id');
        });
        $(document).ready(function(){
            $("#selectFileBtn").click(function(){
                $fileField = $('<input type="file" name="thumbs[]"/>');
                $fileField.hide();
                $("#attachList").append($fileField);
                $fileField.trigger("click");
                $fileField.change(function(){
                $path = $(this).val();
                $filename = $path.substring($path.lastIndexOf("\\")+1);
                $attachItem = $('<div class="attachItem"><div class="left">a.gif</div><div class="right"><a href="#" title="删除附件">删除</a></div></div>');
                $attachItem.find(".left").html($filename);
                $("#attachList").append($attachItem);
                });
            });
            $("#attachList>.attachItem").find('a').live('click',function(obj,i){
                $(this).parents('.attachItem').prev('input').remove();
                $(this).parents('.attachItem').remove();
            });
        });
</script>
</head>
<body>
<h3>添加商品</h3>
<form action="doAdminAction.php?act=editPro&id=3" method="post" enctype="multipart/form-data">
<table width="70%"  border="1" cellpadding="5" cellspacing="0" bgcolor="#cccccc">
    <tr>



        <td align="right">商品名称</td>
<td><input type="text" name="pName"  value="<?php echo $new['pName']?>"/></td>
    </tr>
    <tr>
        <td align="right">商品分类</td>
        <td>
        <select name="cId">
                      <?php foreach ($cates as $v){?>
<option value="<?php echo $v['id']?>" <?php if($v['id']==$new['cId']) echo "selected" ?>><?php echo $v['cate']?></option>

<!--looklook-->
<?php }?>
                    </select>
        </td>
    </tr>
    <tr>
        <td align="right">商品货号</td>
        <td><input type="text" name="pSn"  value="<?php echo $new['pSn']?>"/></td>
    </tr>
    <tr>
        <td align="right">商品数量</td>
        <td><input type="text" name="pNum"  value="<?php echo $new['pNum']?>"/></td>
    </tr>
    <tr>
        <td align="right">商品市场价</td>
        <td><input type="text" name="mPrice"  value="<?php echo $new['mPrice']?>"/></td>
    </tr>
    <tr>
        <td align="right">商品清新价</td>
        <td><input type="text" name="iPrice"  value="<?php echo $new['iPrice']?>"/></td>
    </tr>
    <tr>
        <td align="right">商品描述</td>
        <td>
            <textarea name="pDesc" id="editor_id" style="width:100%;height:150px;"><div class="formwork_titleleft" style="margin:0px;padding:0px;font-size:14px;font-weight:700;color:#666666;font-family:Arial, Helvetica, sans-serif;background-color:#FFFFFF;">
    <div class="formwork" style="margin:0px;padding:10px 0px;font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#666666;background-color:#FFFFFF;">
        <div class="formwork_titleleft" style="margin:0px;padding:0px;font-weight:700;">

        </div>
        <div class="formwork_text" style="margin:0px;padding:0px;">
<?php echo $new['pDesc']?>
        </div>
    </div>
    <div class="formwork" style="margin:0px;padding:10px 0px;font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#666666;background-color:#FFFFFF;">
        <div class="formwork_img" style="margin:0px auto;padding:0px;text-align:center;">
            <img alt="" src="" class="err-product" />
        </div>
    </div>
    </textarea>
        </td>
    </tr>
    <tr>
        <td align="right">商品图像</td>
        <td>
            <a href="javascript:void(0)" id="selectFileBtn">添加附件</a>
            <div id="attachList" class="clear"></div>
        </td>
    </tr>
    <tr>
        <td colspan="2"><input type="submit"  value="编辑商品"/></td>
    </tr>
</table>
</form>
</body>
</html>